//
//  FoodItemView.swift
//  FoodStore
//
//  Created by youwei on 2025/5/2.
//

import SwiftUI
import Kingfisher

/// 美食单个
struct FoodItemView: View {
    
    var model: FoodItemModel
    
    var body: some View {
        VStack(alignment: .leading, spacing: 0) {
            KFImage.url(URL(string: model.imgUrl))
                .placeholder {
                    WebImageLoadingView()
                }
                .onFailureImage(.iconPlaceholderFood)
                .resizable()
                .aspectRatio(1, contentMode: .fill)
                .clipShape(RoundedRectangle(cornerRadius: 12.0))
                .padding(.bottom, 8.0)
            Text(model.title)
                .font(.alibabaPuHuiTi(size: 16.0, weight: .regular))
                .foregroundStyle(.fs000000)
                .lineLimit(1)
            HStack(spacing: 2.0) {
                Text(model.price)
                    .font(.inter(size: 16.0, weight: .extraBold))
                    .lineLimit(1)
                    .minimumScaleFactor(0.6)
            }
            .foregroundStyle(Color.fsFB5D3B)
        }
    }
}

